<!--
 * @Description: 工程绑定详情页面
 * @Author: charles
 * @Date: 2021-12-14 22:17:25
 * @LastEditors: HeAo
 * @LastEditTime: 2021-12-19 11:47:40
-->
<template>
  <div>
    工程详情
    {{ engineerData }}
    <br />
    {{ devices }}
  </div>
</template>
<script>
import { get } from "@/utils/request";
export default {
  data() {
    return {
      engineerData: {},
      devices: [],
    };
  },
  methods: {
    // 根据工程id查询设备信息
    findDevicesByEngineerId() {
      const params = {
        page: 1,
        pageSize: 100,
        engineer_id: this.engineerData.id,
      };
      get("/device/pageQuery", params).then((res) => {
        this.devices = res.data.list;
      });
    },
  },
  created() {
    // 获取路由跳转携带的参数
    this.engineerData = this.$route.query;
    // 根据工程id查询该工程下绑定的设备
    this.findDevicesByEngineerId();
  },
};
</script>